﻿using System;
using System.Collections.Generic;
using LINQ = JLL.China.Infrastructure.Repositories.LINQ2SQL;

namespace JLL.China.Infrastructure.Repositories.Banner
{
    public class BannerFactory
    {

        public static Model.Banner FromLINQObject(LINQ.Banner banner)
        {
            if (banner == null)
                return null;
            else
            {
                var model = new Model.Banner
                {
                   _Id = banner.ID,
                    Banner_ID = banner.Banner_ID,
                    BannerUrl = banner.BannerUrl,
                    Link = banner.Link,
                    Status = banner.Status,
                    Title = banner.Title,
                    Sequence = banner.Sequence,
                    BannerGroupFID = banner.BannerGroupFID,
                    Content = banner.Content,
                    LanguageFID =  banner.LanguageFID,
                    ParentID = banner.ParentID,
                    DynamicType = banner.DynamicType,
                    Type = banner.Type
                    
                };
                return model;
            }
        }

        public static LINQ.Banner ToLINQObject(Model.Banner banner)
        {
            var model = new LINQ.Banner
            {
                Banner_ID = banner.Banner_ID,
                BannerUrl = banner.BannerUrl,
                Link = banner.Link,
                Status = banner.Status,
                Title = banner.Title,
                Sequence = banner.Sequence,
                BannerGroupFID = banner.BannerGroupFID,
                Content = banner.Content,
                LanguageFID = banner.LanguageFID,
                ParentID = banner.ParentID,
                DynamicType = banner.DynamicType,
                Type = banner.Type
            };
            return model;
        }
    }
}
